<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->bigIncrements('id')->comment('自增ID');
            $table->unsignedBigInteger('user_id')->comment('唯一用户ID');

            $table->string('nickname', 100)->comment('用户昵称');
            $table->unsignedTinyInteger('sex')->default(0)->comment('性别 0:未知 1:男 2:女');
            $table->string('avatar', 255)->nullable()->comment('用户头像');
            $table->string('phone', 100)->nullable()->comment('用户手机');
            $table->string('mini_openid', 100)->comment('小程序openid');

            $table->timestamps();
            $table->softDeletes();

            $table->engine = 'InnoDB';

        });
        DB::statement("alter table `users` comment'用户表'");

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
